﻿<%@ Page Language="C#" MasterPageFile="~/Share/MainPage.Master" AutoEventWireup="true"
    CodeBehind="OrderMap.aspx.cs" Inherits="AKMII.DMRA.Web.OrderMap" Title="Order Map" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Src="~/Controls/SurveyDiv.ascx" TagName="SurveyDiv" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>
    <script type="text/javascript" src="../Content/Js/map.js" language="javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="InfoContent" runat="server">
    <div style="height: 312px">
        <br />
        You are working on assignment:
        <br />
        Agent:<asp:Label ForeColor="Red" ID="lblInfoAgent" runat="server" Text="0"></asp:Label><br />
        Week:<asp:Label ForeColor="Red" ID="lblInfoWeek" runat="server" Text="0"></asp:Label><br />
        Active stops must be between
        <asp:Label ForeColor="Red" ID="lblLower" runat="server" Text="0"></asp:Label>
        and
        <asp:Label ForeColor="Red" ID="lblUpper" runat="server" Text="0"></asp:Label>.<br />
        Your total stops so far:<br />
        <asp:Label ForeColor="Red" ID="lbActiveLead" runat="server" Text="0"></asp:Label>
        Active;<br />
        <asp:Label ForeColor="Red" ID="lbLapseLead" runat="server" Text="0"></asp:Label>
        Lapsed;
        <br />
        <asp:Label ForeColor="Red" ID="lbNeighborLead" runat="server" Text="0"></asp:Label>
        Neighbor;
        <br />
        <asp:Label ForeColor="Red" ID="lbBussinessLead" runat="server" Text="0"></asp:Label>
        Business;
        <asp:Label ForeColor="Red" ID="lbSelected" runat="server" Visible="false"></asp:Label>
        <br />
        <br />
        <div style="text-align: center">
            <input type="button" id="btnNextWeeek" value="Next Week" class="loginbuttonBtnx"
                onclick=" NextWeek();" />
            <input type="button" id="btnweek" value="Next Agent or Month" class="loginbuttonBtnx"
                disabled="disabled" onclick="CreateLeadsMap();" />
            <input type="button" id="btnSelectWeek" value="Select Week" class="loginbuttonBtnx"
                onclick="SelectWeek();" />
            <input type="button" id="btnSelectCities" value="Select Cities" class="loginbuttonBtnx"
                onclick="SelecCities();" />
        </div>
    </div>
    <script type="text/javascript">
        function DisplayTooltip(value) {
            document.getElementById("divTooltip").style.display = value;
        }
        function showHistoryWindow(htmUrl) {
            var url = htmUrl;
            var winName = 'View Print Order History';
            var awidth = screen.availWidth / 6 * 3;
            var aheight = screen.availHeight / 5 * 3;
            var atop = (screen.availHeight - aheight) / 2;
            var aleft = (screen.availWidth - awidth) / 2;
            var param0 = "status=0,menubar=0,resizable=2,location=0,scrollbars=yes";
            var params = "top=" + atop + ",left=" + aleft + ",width=670,height=" + aheight + "," + param0;
            win = window.open(url, 'new', params + param0);
            win.focus();
        }
    </script>
    <br />
    <div class="leadinfo" style="position: relative; top: 0px; left: 0px; height: 258px;">
        <div id="divTooltip" onmouseout="DisplayTooltip('none');" style="background-color: #E1EEF6;
            position: absolute; top: 15px; display: none; border: 1px #000000 solid; padding-left: 5px">
            Target number of leads are based on active leads plus lapse leads ( neighbor and
            business are not - although you still get them).<br />
            Agents can work on average 50 active & lapse leads per week.<br />
            As an example, an MD has Y amount of agents working in his or her market.<br />
            Therefore (50*num of weeks in the month)*Y=Z (where Z is the target number of leads)<br />
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="LinkContent" runat="server">
    <a id="breadcrumb_home" href="#">Home</a>&nbsp;&gt;&nbsp; <a id="A1" href="javascript:void(0);">
        Order Map</a>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="DetailsContent" runat="server">
    <input id="button1" onclick="UnSelectAll();" type="button" class="loginbuttonBtnx"
        value="Unselect All" />&nbsp;&nbsp;View
    <select id="Select1" onchange="ResetPushpin();FilterLeads();" name="D1">
        <option>Only Leads In Cart</option>
        <option selected>Lead Block</option>
        <option>By Assignments</option>
        <option>Last order</option>
    </select>
    &nbsp;&nbsp;By zip:<select id="selectFilterZip" onclick="FilterLeads()"><option value="0">
        All</option>
    </select>&nbsp;&nbsp;By city:<select id="selectFilterCity" onclick="FilterLeads()"><option
        value="0">All</option>
    </select>
    <asp:HiddenField ID="hideZipCode" runat="server" />
    <asp:HiddenField ID="hideLastMonthDate" runat="server" />
    <asp:HiddenField ID="hideAgentTerr" runat="server" />
    <asp:HiddenField ID="hideAgentLocation" runat="server" />
    <table border="0">
        <tr>
            <td>
                <div id="myMap1">
                    <br />
                    <br />
                </div>
            </td>
        </tr>
    </table>
    <div id="divmassage_box1" style="width: 227px; height: 150px;">
        <div class="divmassage1">
            <div class="divheader1">
                <div style="display: inline; width: 150px; position: absolute;">
                    Assign Agent
                </div>
                <span onclick="divmassage_box1.style.visibility='hidden'; divmask1.style.visibility='hidden'"
                    style="float: right; display: inline; cursor: hand">×</span></div>
            <div>
                <br />
                Assign To:
                <asp:DropDownList ID="drpAssignment" runat="server">
                </asp:DropDownList>
                <br />
                &nbsp;&nbsp;&nbsp;
                <input id="Button6" type="button" value="Assign" class="loginbuttonBtnz" onclick="ShowAssignDiv();" /></div>
        </div>
    </div>
    <div id="divPolygon">
        <div class="divmassage2">
            <div id="PolyMenuContent">
            </div>
        </div>
    </div>
    <div id="divmassage_box2" style="width: 651px; height: 270px;">
        <div class="divmassage1">
            <div class="divheader3">
                <div style="display: inline; text-align: left; position: absolute;">
                    Select the agent and assignments (weeks)
                </div>
                <span class="divheader1" style="float: right; display: inline; cursor: hand"></span>
            </div>
            <div align="center">
                <br />
                <table style="border: 0px; width: 95%; text-align: center;">
                    <tr>
                        <td align="left">
                            What agent are you ordering for?&nbsp; &nbsp;
                            <asp:DropDownList ID="drpOrderAgent" runat="server">
                            </asp:DropDownList>
                            &nbsp;&nbsp;
                            <input type="btnCreateAssign" value="Create Assignment" class="loginbuttonBtnx" onclick="divCreateAssign.style.visibility='visible'; divmask1.style.visibility='visible'" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            What month are you ordering for?&nbsp; &nbsp;<asp:DropDownList ID="drpOrderMonth"
                                runat="server">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            How many assignments (weeks) will this agent need?&nbsp; &nbsp;<asp:DropDownList
                                ID="drpOrderWeeks" runat="server">
                                <asp:ListItem Text="1" Value="1"></asp:ListItem>
                                <asp:ListItem Text="2" Value="2"></asp:ListItem>
                                <asp:ListItem Text="3" Value="3"></asp:ListItem>
                                <asp:ListItem Text="4" Value="4"></asp:ListItem>
                                <asp:ListItem Text="5" Value="5"></asp:ListItem>
                                <asp:ListItem Text="6" Value="6"></asp:ListItem>
                                <asp:ListItem Text="7" Value="7"></asp:ListItem>
                                <asp:ListItem Text="8" Value="8"></asp:ListItem>
                                <asp:ListItem Text="9" Value="9"></asp:ListItem>
                                <asp:ListItem Text="10" Value="10"></asp:ListItem>
                                <asp:ListItem Text="11" Value="11"></asp:ListItem>
                                <asp:ListItem Text="12" Value="12"></asp:ListItem>
                                <asp:ListItem Text="13" Value="13"></asp:ListItem>
                                <asp:ListItem Text="14" Value="14"></asp:ListItem>
                                <asp:ListItem Text="15" Value="15"></asp:ListItem>
                                <asp:ListItem Text="16" Value="16"></asp:ListItem>
                                <asp:ListItem Text="17" Value="17"></asp:ListItem>
                                <asp:ListItem Text="18" Value="18"></asp:ListItem>
                                <asp:ListItem Text="19" Value="19"></asp:ListItem>
                                <asp:ListItem Text="20" Value="20"></asp:ListItem>
                                <asp:ListItem Text="21" Value="21"></asp:ListItem>
                                <asp:ListItem Text="22" Value="22"></asp:ListItem>
                                <asp:ListItem Text="23" Value="23"></asp:ListItem>
                                <asp:ListItem Text="24" Value="24"></asp:ListItem>
                                <asp:ListItem Text="25" Value="25"></asp:ListItem>
                                <asp:ListItem Text="26" Value="26"></asp:ListItem>
                                <asp:ListItem Text="27" Value="27"></asp:ListItem>
                                <asp:ListItem Text="28" Value="28"></asp:ListItem>
                                <asp:ListItem Text="29" Value="29"></asp:ListItem>
                                <asp:ListItem Text="30" Value="30"></asp:ListItem>
                                <asp:ListItem Text="31" Value="31"></asp:ListItem>
                                <asp:ListItem Text="32" Value="32"></asp:ListItem>
                                <asp:ListItem Text="33" Value="33"></asp:ListItem>
                                <asp:ListItem Text="34" Value="34"></asp:ListItem>
                                <asp:ListItem Text="35" Value="35"></asp:ListItem>
                                <asp:ListItem Text="36" Value="36"></asp:ListItem>
                                <asp:ListItem Text="37" Value="37"></asp:ListItem>
                                <asp:ListItem Text="38" Value="38"></asp:ListItem>
                                <asp:ListItem Text="39" Value="39"></asp:ListItem>
                                <asp:ListItem Text="40" Value="40"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
                <p>
                </p>
                <input id="btnNext" type="button" value="Next" class="loginbuttonBtnz" onclick="ShowFilters1()" />&nbsp;&nbsp;&nbsp;&nbsp;
                <input id="Next1" type="button" value="Done-No More Agents" class="loginbuttonBtnx"
                    onclick="window.location.href='ShoppingCart.aspx'" />
            </div>
        </div>
    </div>
    <div id="divmessage_box3" style="width: 491px; height: 380px;">
        <div class="divmassage1">
            <div class="divheader3">
                <div style="display: inline; text-align: left; position: absolute;">
                    Select a county and city
                </div>
            </div>
            <div align="center">
                <br />
                <table style="border: 0px; width: 97%; text-align: center;">
                    <tr>
                        <td align="left">
                            Lets start with week <span id="spanWeek"></span>of <span id="spanMonth"></span>lead
                            order. After you add this week to your order, we'll move to the next week.<br />
                            Select the county that <span id="spanAgent1"></span>will be working in.
                            <asp:DropDownList ID="DrpOrderCounty" runat="server">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Which city(s) will <span id="spanAgent2"></span>work in week <span id="spanWeek1">
                            </span>?
                            <br />
                            (Hold the control key to select multiple cities)
                            <select id="selectOrderCity" size="10" multiple="multiple" name="D2">
                            </select>
                        </td>
                    </tr>
                </table>
                <p>
                </p>
                <input id="btnShow" type="button" value="Show available assignments on the map" class="BtnMaxLenth"
                    onclick="GoToMap();" />&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
        </div>
    </div>
    <div id="divMapLead" style="width: 700px; height: 507px;">
        <div class="divmassage2" style="text-align: center;">
            <div class="divheader2">
                <div style="display: inline; text-align: left; position: absolute;">
                    Map Contacts
                </div>
            </div>
            <br />
            &nbsp;&nbsp;Are you sure you want to place these contacts in your cart for order
            given there geographical location?
            <br />
            <input id="btnAddTo" type="button" value="Yes" class="filterbutton" onclick=" addLeadsToCart();  divMapLead.style.visibility = 'hidden';  mapWithLeads.style.visibility = 'hidden';   divmassage_box2.style.visibility = 'visible'; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input id="Button4" type="button" value="No" class="filterbutton" onclick="  divMapLead.style.visibility = 'hidden';  mapWithLeads.style.visibility = 'hidden';     divmask1.style.visibility = 'hidden';divmassage_box2.style.visibility='hidden' " />
        </div>
    </div>
    <div id="divDefaultAssigment" style="width: 387px; height: 150px;">
        <div class="divmassage1">
            <div class="divheader1">
                <div style="display: inline; width: 250px; position: absolute;">
                   Default Lead Assignment
                </div>
                <span onclick="divDefaultAssigment.style.visibility = 'hidden';divmask1.style.visibility = 'hidden';"
                    style="float: right; display: inline; cursor: hand">×</span></div>
            <div>
               This assignment contains leads that fall into any of the following classifications: Leads having a P.O. Box address, an undeliverable USPS address or a Do Not Contact record. 
               <br /> </div><div style="text-align:center;"><input id="Button2" type="button" value="OK" class="loginbuttonBtnz" onclick="divDefaultAssigment.style.visibility = 'hidden';divmask1.style.visibility = 'hidden';" /></div>
        </div>
    </div>
    <div id="mapWithLeads" align="center" style="width: 620px; height: 370px; background-color: Gray;">
    </div>
    <div id="divMustOrder">
        <div class="divmassage1" style="text-align: center; height: 200PX; width: 300px;">
            <div class="divheader2">
                <div style="display: inline; text-align: left; position: absolute;">
                    Must order reason:
                </div>
            </div>
            <br />
            <select id="textarea">
                <option>Choose the reason</option>
                <option>Assignment was not dispursed to agent</option>
                <option>Agent did not COMPLETE the assignment</option>
                <option>Agent did not work ANY of the assignment</option>
                <option>Other</option>
            </select>
            <br />
            <br />
            <input id="Button5" type="button" value="submit and add to cart." class="loginbuttonBtnx"
                onclick="addToCartRuleWithReason();  " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input id="Button7" type="button" value="Cancel" class="filterbutton" onclick="  divMustOrder.style.visibility = 'hidden'; divmask1.style.visibility = 'hidden';" />
        </div>
    </div>
    <div id="divMustOrder1">
        <div class="divmassage1" style="text-align: center; height: 200PX; width: 400px;">
            <div class="divheader2">
                <div style="display: inline; text-align: left; position: absolute;">
                    Must order reason:
                </div>
            </div>
            <br />
            <select id="textarea1">
                <option>Select the reason</option>
                <option>Assignment was not dispursed to agent</option>
                <option>Agent did not COMPLETE the assignment</option>
                <option>Agent did not work ANY of the assignment</option>
                <option>Other</option>
            </select>
            <br />
            <br />
            <input id="Button8" type="button" value="submit and add to cart." class="loginbuttonBtnx"
                onclick="polygonToCartRuleWithReason();  " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input id="Button9" type="button" value="Cancel" class="filterbutton" onclick="  divMustOrder1.style.visibility = 'hidden'; divmask1.style.visibility = 'hidden';" />
        </div>
    </div>
    <div id="divCreateAssign" style="width: 327px; height: 197px;">
        <div align="center" class="divmassage1">
            <div class="divheader3">
                <div style="display: inline; width: 150px; position: absolute;">
                    Create Assignment
                </div>
                <span class="divheader1" onclick="divCreateAssign.style.visibility='hidden'; divmask1.style.visibility='hidden'"
                    style="float: right; display: inline; cursor: hand">×</span></div>
            <div>
                <table style="border: 0px; width: 94%;">
                    <tr>
                        <td align="left">
                            Type a name for this assignment below, then you will see it available in the drop
                            down menu.
                        </td>
                    </tr>
                    <tr>
                        <td height="10px">
                        </td>
                    </tr>
                </table>
                <input id="Text1" type="text" class="txtAssign" maxlength="28" />
                <p>
                </p>
                <input id="btnCreate" type="button" value="Create Assignment" class="loginbuttonBtnx"
                    onclick=" createAssign(Text1.value);" />
            </div>
        </div>
    </div>
    <div id="divAlert" style="width: 327px; height: 157px;">
        <div align="center" class="divmassage1">
            <div class="divheader2">
                <span class="divheader2" onclick="divAlert.style.visibility='hidden'; " style="float: right;
                    display: inline; cursor: hand">×</span></div>
            <div style="text-align: left;">
                &nbsp;&nbsp; Because you selected a month other than the current month you order
                will be saved,but you will need to log in and go to the shopping cart to place your
                order for this month.
                <br />
            </div>
            <div style="text-align: center">
                <input type="button" value="OK" onclick="divAlert.style.visibility='hidden';divmessage_box3.style.visibility = 'visible'; "
                    class="loginbuttonBtnz" />
            </div>
        </div>
    </div>
    <div id="divLoading" style="width: 150px; height: 37px; top: 263px; left: 549px;">
        <div align="center" class="divmassage1">
            Loading.....
        </div>
    </div>
    <div id="divmask1">
    </div>
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
    </asp:ScriptManager>
    <uc1:SurveyDiv ID="SurveyDiv1" runat="server" Visible="false" />
</asp:Content>
